package org.kosta.android.samples.part1;

import org.kosta.android.samples.KostaAndroidSampleActivity;
import org.kosta.android.samples.R;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;

public class LifeCycleViewActivity extends Activity {
	
	public static final String LOG_TAG = "LifeCycleViewActivity";
	
	private Button mBtn;
	private ImageButton mImageBtn;
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Log.i(LOG_TAG, "onCreate(Bundle) invoked");

        setContentView(R.layout.life_cycle);
        
        mImageBtn = (ImageButton)findViewById(R.id.top_left_button);
        mImageBtn.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				finish();
			}
		});
        
        mBtn = (Button)findViewById(R.id.top_right_button);
        mBtn.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				Intent intent = new Intent(v.getContext(), KostaAndroidSampleActivity.class);
				//intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
				startActivity(intent);
			}
		});
    }
    
    
    @Override
    public void onRestoreInstanceState(Bundle savedInstanceState) {
        super.onRestoreInstanceState(savedInstanceState);
        Log.i(LOG_TAG, "onRestoreInstanceState(Bundle) invoked");
    }
    
    @Override
    public void onStart() {
        super.onStart();
        Log.i(LOG_TAG, "onStart() invoked");
    }
    
    @Override
    public void onResume() {
        super.onResume();
        Log.i(LOG_TAG, "onResume() invoked");
    }
        
    @Override
    public void onRestart() {
        super.onRestart();
        Log.i(LOG_TAG, "onRestart() invoked");
    }   
    
    @Override
    protected void onPause() {
        super.onPause();
        Log.i(LOG_TAG, "onPause() invoked");
    }
    
    @Override
    public void onSaveInstanceState(Bundle b) {
        super.onSaveInstanceState(b);
        Log.i(LOG_TAG, "onSaveInstanceState(Bundle) invoked");
    }
    
    @Override
    public void onStop() {
        super.onStop();
        Log.i(LOG_TAG, "onStop() invoked");
    }
    
    @Override
    public void onDestroy() {
        super.onDestroy();
        Log.i(LOG_TAG, "onDestroy() invoked");
    }   

}